var getOS= function() {

    var u = navigator.userAgent;
    var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
    var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
    if(isAndroid) return 'android';
    if(isiOS) return 'ios';

}
function isweixin() {
    var ua = window.navigator.userAgent.toLowerCase();
    if(ua.match(/MicroMessenger/i) == 'micromessenger'){
        return true;
    } else {
        return false;
    }
}
function creatLink(url){
    var myFrame= document.createElement('iframe');
    myFrame.src = url;
    myFrame.style.display = 'none';
    document.body.appendChild(myFrame);
}

//一键调用此方法实现安装包（安卓、苹果）下载
function downApp() {
    if( isweixin() ){
        //提示前往其他浏览器打开下载
        $("#title-model").css("display", "block");
        return;
    }
    else if(window.innerWidth > 768){
        document.body.innerHTML= "Please open this application at the mobile end ！android or ios.";
        return;
    }

    if(getOS()== "ios"){
        location.href= "https://itunes.apple.com/us/app/4%E6%9C%8819%E6%97%A5/id1336384256?l=zh&ls=1&mt=8";
    }
    else if(getOS()== "android"){
        creatLink( location.origin+ "/assest/pack_app/Android/4月19日.apk" );
    }
}


